//
//  NextViewController.m
//  Crash
//
//  Created by 周成龙 on 2019/5/7.
//  Copyright © 2019 周成龙. All rights reserved.
//

#import "NextViewController.h"

@interface NextViewController () <UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation NextViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:0];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    [self.view addSubview:self.tableView];
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 100;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    NSString *cellText = nil;
    if (indexPath.row % 10 == 0) {
        sleep(1);
        cellText = @"这里卡住了";
//        UIImageView *iv = [[UIImageView alloc] init];
//        iv.layer.cornerRadius = 20;
//        iv.layer.masksToBounds = YES;
//        iv.image = [UIImage imageNamed:@"maomai-000.jpg"];
//        [cell setValue:iv forKeyPath:@"imageView"];
    } else {
        cellText = [NSString stringWithFormat:@"cell%ld",indexPath.row];
    }
    
    cell.textLabel.text = cellText;
    
    return cell;
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
